import {BaseEntity, Column, Entity, Index, JoinColumn, JoinTable, ManyToMany, ManyToOne, OneToMany, OneToOne, PrimaryColumn, PrimaryGeneratedColumn, RelationId} from 'typeorm';

@Entity('mall_ad', {schema:'nest-mall' } )
@Index('position_id', ['adPositionId', ])
@Index('enabled', ['enabled', ])
export class MallAd {

    @PrimaryGeneratedColumn({
        type: "smallint",
        name: "id",
        })
    id: number;

    @Column('smallint', {
        nullable: false,
        default: () => '\'0\'',
        name:'ad_position_id'
        })
    adPositionId: number;

    @Column('tinyint', {
        nullable: false,
        default: () => '\'0\'',
        name: "media_type",
        })
    mediaType: number;

    @Column('varchar', {
        nullable: true,
        length: 60,
        name: "name",
        })
    name: string | null;

    @Column('varchar', {
        nullable: true,
        name:'link'
        })
    link: string | null;

    @Column('text', {
        nullable: true,
        name:'image_url'
        })
    imageUrl: string | null;

    @Column('varchar', {
        nullable: true,
        name:'content'
        })
    content: string | null;

    @Column('datetime', {
        nullable: true,
        name:'end_time'
        })
    endTime: Date | null;

    @Column('tinyint', {
        nullable: true,
        default: () => '\'1\'',
        name: "enabled",
        })
    enabled: number | null;

}
